import request from '@/utils/request'

// 查询项目文档目录列表
export function listCatalog(query) {
    return request({
        url: '/businessWorkbench/catalog/list',
        method: 'get',
        params: query
    })
}

// 查询项目文档目录详细
export function getCatalog(guid) {
    return request({
        url: '/businessWorkbench/catalog/' + guid,
        method: 'get'
    })
}

// 新增项目文档目录
export function addCatalog(data) {
    return request({
        url: '/businessWorkbench/catalog',
        method: 'post',
        data: data
    })
}

// 修改项目文档目录
export function updateCatalog(data) {
    return request({
        url: '/businessWorkbench/catalog',
        method: 'put',
        data: data
    })
}

// 删除项目文档目录
export function delCatalog(guid) {
    return request({
        url: '/businessWorkbench/catalog/' + guid,
        method: 'delete'
    })
}

// 导出项目文档目录
export function exportCatalog(query) {
    return request({
        url: '/businessWorkbench/catalog/export',
        method: 'get',
        params: query
    })
}

// 查询项目文档目录下拉树结构
export function treeselect(query) {
    return request({
        url: '/businessWorkbench/catalog/treeselect',
        method: 'get',
        params: query
    })
}

// 优化版-查询项目文档目录下拉树结构
export function treeselectNew(query) {
    return request({
        url: '/businessWorkbench/catalog/treeselectNew',
        method: 'get',
        params: query
    })
}

// 优化版-根目录-查询项目文档目录下拉树结构
export function treeselectFirstNew(query) {
    return request({
        url: '/businessWorkbench/catalog/treeselectFirstNew',
        method: 'get',
        params: query
    })
}


// 查询项目文档目录下拉树结构
export function treeselect1(query) {
    return request({
        url: '/businessWorkbench/catalog/treeselect1',
        method: 'get',
        params: query
    })
}

/**
 * 项目文档接口
 */
//查询项目文档列表
export function businessDocList(query) {
    return request({
        url: '/businessWorkbench/doc/list',
        method: 'get',
        params: query
    })
}

/**
 * 项目文档接口
 */
//查询项目文档列表
export function businessDocListResult(query) {
    return request({
        url: '/businessWorkbench/doc/listResult',
        method: 'get',
        params: query
    })
}

//获取项目文档详情
export function businessDoc(id) {
    return request({
        url: '/businessWorkbench/doc/' + id,
        method: 'get',
    })
}
//新增项目文档
export function addDoc(data) {
    return request({
        url: '/businessWorkbench/doc',
        method: 'post',
        data: data
    })
}
//修改项目文档
export function updateDoc(data) {
    return request({
        url: '/businessWorkbench/doc',
        method: 'put',
        data: data
    })
}
//删除项目文档
export function deleteDoc(id) {
    return request({
        url: '/businessWorkbench/doc/' + id,
        method: 'delete',
    })
}
//删除项目文档目录 
export function deleteCatalog(id) {
    return request({
        url: '/businessWorkbench/catalog/' + id,
        method: 'delete',
    })
}

// 删除项目文档目录-校验
export function deleteCatalogCheck(guid) {
    return request({
        url: '/businessWorkbench/catalog/removeCheck/' + guid,
        method: 'delete',
    })
}

//移动目录文档 
export function moveBusinessDoc(data) {
    return request({
        url: '/businessWorkbench/doc/move',
        method: 'post',
        data: data
    })
}

//导入清单
export function importData(data) {
    return request({
        url: '/businessWorkbench/catalog/importData',
        method: 'post',
        data: data
    })
}

//导入模板
export function importTemplate(guid, id) {
    return request({
        url: '/businessWorkbench/catalog/' + guid + '/' + id,
        method: 'get'
    })
}


//历史文件列表
export function historyFiles(query) {
    return request({
        url: '/businessWorkbench/doc/historyList',
        method: 'get',
        params: query
    })
}

//更新文件
export function updateFile(oldId, newId) {
    return request({
        url: '/businessWorkbench/doc/updateHistoryAttach/' + oldId + '/' + newId,
        method: 'get'
    })
}

// 项目文档查询
export function wholeDocQuery(query) {
    return request({
        url: '/businessWorkbench/doc/wholeDocQuery',
        method: 'get',
        params: query
    })
}

// 导出项目文档目录
export function wholeDocQueryExport(query) {
    return request({
        url: '/businessWorkbench/doc/wholeDocQueryExport',
        method: 'get',
        params: query
    })
}

// 查询项目文档是否有目录
export function getCatalogCounts(businessId) {
    return request({
        url: '/system/docCatalogTemplate/getCatalogCounts/' + businessId,
        method: 'get'
    })
}